package dao.NewDaoImpl;

import dao.NewsDao;
import entity.News;
import org.hibernate.SQLQuery;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import java.util.List;

public class NewDaoImpl extends HibernateDaoSupport implements NewsDao {
    @Override
    public List<News> getNewList() {
        SQLQuery sqlQuery = getSession().createSQLQuery("select * from t_news limit ?,?").addEntity(News.class);
        sqlQuery.setInteger(0,0);
        sqlQuery.setInteger(1,2);
        List<News> newsList = sqlQuery.list();
        return newsList;
    }
}